// router.js
var commons = require('./commons.js');

function getRecall(resp){
    resp.writeHead(200, {'Content-Type': 'text/html; charset=utf-8'});
    return function(data){
        resp.write(data);
        resp.end();
    }
}

module.exports = {
    login: function(req, resp){
        var path = './view/login.html';
        var recall = getRecall(resp);
        commons.readFile(path, recall);
    },
    readImg: function(req, resp){
        resp.writeHead(200, {'Content-Type': 'image/jpeg'});
        var path = './img/mingren.jpg';
        commons.readImg(path, resp);
    }
};